package com.beerandjesus.sportofkings.handicapper;

import com.beerandjesus.sportofkings.handicapper.migration.hibernate.HibernateConfig;
import com.beerandjesus.sportofkings.handicapper.migration.hibernate.HibernateCopier;
import com.beerandjesus.sportofkings.handicapper.migration.hibernate.Migrator;
import com.beerandjesus.sportofkings.handicapper.migration.hibernate.SessionFactoryBuilder;
import org.hibernate.SessionFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * Date: 3/20/15
 * Time: 10:39 PM
 */
public class MigrateApp {

    public static void main(String[] args) {

        List<Class<?>> entityClasses = new ArrayList<Class<?>>();


        SessionFactoryBuilder sessionFactoryBuilder = new SessionFactoryBuilder();
        SessionFactory sessionFactorySource = sessionFactoryBuilder.buildSessionFactory(entityClasses,
                new HibernateConfig("", "", "", "", "")
        );
        SessionFactory sessionFactoryTarget = sessionFactoryBuilder.buildSessionFactory(entityClasses,
                new HibernateConfig("", "", "", "", "")
        );

        Migrator migrator = new Migrator(
                sessionFactorySource,
                sessionFactoryTarget,
                new HibernateCopier(),
                entityClasses);

        migrator.migrate();

        sessionFactorySource.close();
        sessionFactoryTarget.close();
    }
}
